<template>
  <div class="ct-slide" v-if="slideList.length != 0">
    <div
      @click="slideClick(item.maitKey, item.miniWallkey,index)"
      class="slide-item"
      v-for="(item,index) in slideList"
      :key="index"
      :class="{'active': currentIndex === index}"
    >{{item.title}}</div>
  </div>
</template>

<script>
export default {
  name: "category-silde",
  components: {},
  props: {
    slideList: {
      type: Array,
      default() {
        return [];
      }
    }
  },
  data() {
    return {
      currentIndex: 0
    };
  },
  methods: {
    slideClick(maitKey, miniWallkey, index) {
      this.currentIndex = index;
      this.$emit("slideclick", {
        maitKey,
        miniWallkey,
        index
      });
    }
  }
};
</script>

<style scoped>
.slide-item {
  padding: 12px 0;
  text-align: center;
  border-bottom: 1px solid #f1f1f1;
  color: #333;
  position: relative;
}
.slide-item.active::before {
  content: "";
  display: block;
  position: absolute;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--color-tint);
}
</style>